/* 懒加载 */
/* 打包的配置 */
/*
*   配置路由表
*   数组，数组中每一项都是需要配置的路由规则
*       + redirect:true     重定向
*       + path              地址
*       + from              来源地址
*       + to                重定向地址
*       + exact             是否精准匹配
*       + component         渲染的组件
*       + name              路由名称
*       + meta:{}           路由元信息(包含当前路由的一些信息)
*       + children          子路由
*       + ...
*  */
import {lazy} from 'react'
import A from "../views/styled-components+style/A-route-v5.jsx"
// import B from "../views/styled-components+style/B.jsx"
// import C from "../views/styled-components+style/C.jsx"
// import A1 from "../views/styled-components+style/a/A1.jsx"
// import A2 from "../views/styled-components+style/a/A2.jsx"
// import A3 from "../views/styled-components+style/a/A3.jsx"

// 通过 webpack 的   /*webpackChunkName:"AChild1"*/  可以指定打包后的文件的名称，名字相同的组件，会合并打包到一个文件中

// 一级路由的路由表
const routes = [
    {
        redirect: true,
        from: "/",
        to: "/a",
        exact: true
    }, {
        path: "/a",
        name: "a",
        component: A,
        meta: {},
        children: [
            {
                redirect: true,
                from: "/a",
                to: "/a/a1",
                exact: true
            },
            {
                path: "/a/a1",
                name: "a-a1",
                component: lazy(() => import(/*webpackChunkName:"AChild"*/"../views/styled-components+style/a/A1.jsx")),
                children: []
            },
            {
                path: "/a/a2",
                name: "a-a2",
                component: lazy(() => import(/*webpackChunkName:"AChild"*/"../views/styled-components+style/a/A2.jsx")),
                children: []
            },
            {
                path: "/a/a3",
                name: "a-a3",
                component: lazy(() => import(/*webpackChunkName:"AChild"*/"../views/styled-components+style/a/A3.jsx")),
                children: []
            },
        ]
    }, {
        path: "/b",
        name: "b",
        component: lazy(() => import(/*webpackChunkName:"B"*/"../views/styled-components+style/B.jsx")),
        meta: {},
    }, {
        // path: "/c/:id?/:name",// 路径传参
        path: "/c",
        name: "c",
        component: lazy(() => import(/*webpackChunkName:"C"*/"../views/styled-components+style/C.jsx")),
        meta: {},
    }, {
        redirect: true,
        to: "/a"
    }
]


export default routes